from locust import HttpLocust, TaskSet, task

# locust --host=http://127.0.0.1:6677


class WebsiteTasks(TaskSet):
    def on_start(self):
        login()

    def login(self):
        self.client.post("/login/login", {
            "userName": "admin",
            "password": "admin123"
        })

    @task
    def test1(self):
        self.client.get("/test1")

    @task
    def test2(self):
        self.client.get("/test2")


class WebsiteUser(HttpLocust):
    task_set = WebsiteTasks
    min_wait = 5000
    max_wait = 15000
